Allow rustup-init to install the default toolchain from a toolchain file #2751
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows rustup-init to install a default toolchain from a specified toolchain file.
In the current draft PR:
The toolchain file is only checked for the channel field, which to the best of my knowledge corresponds to the
toolchain
field. I could also add overrides for the other fields which can be specified in the toolchain file: thetarget
(in rust-toolchain.toml)/host
(in rustup), thecomponents
and theprofile
.I re-used the name suggested by @XAMPPRocky,
--from-file
.The toolchain specified by the toolchain file is only used if the
--default-toolchain
option is not given.The parse mode is determined based on the file extension, if it has a
toml
file extension, theTomlOnly
mode is used, else, the legacy mode is available. When the toolchain file is used to override current toolchain, the toolchain file name is fixed. In the suggested option this is not necessarily the case, so I opted to take this middle ground for now.I will add extra test cases in a bit (I'm a bit figuring out how the testing setup works :))
closes #2749